﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/HomeSite.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<TimeTableManagement.Entities.Tb_People>>" %>

<%@ Register Assembly="DevExpress.Web.v11.1, Version=11.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxRoundPanel" TagPrefix="dx" %>

<%@ Register assembly="DevExpress.Web.v11.1, Version=11.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxPanel" tagprefix="dx" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<div id="dialogdelete" title="Delete This">
    <% using (Html.BeginForm("Delete", "Student", FormMethod.Post)) { %>
    <h2>Are you sure you want to delete this?</h2>
    <h3>Lecturer: <span id="name" name="name"></span></h3>
    <input id="id" name="id" type="hidden" />
    <p>
        <input type="submit" value="Delete" />
    </p>
    <% } %>
</div>
    <dx:ASPxRoundPanel ID="ASPxRoundPanel1" runat="server" Width="100%" 
        CssFilePath="~/App_Themes/Aqua/{0}/styles.css" CssPostfix="Aqua" 
        GroupBoxCaptionOffsetY="-28px" 
        SpriteCssFilePath="~/App_Themes/Aqua/{0}/sprite.css">
        <ContentPaddings Padding="14px" />
        <PanelCollection>
<dx:PanelContent ID="PanelContent1" runat="server" SupportsDisabledAttribute="True">
<table style="width:100%" id="t1" class="example table-autosort
 table-autofilter table-autopage:10 
 table-stripeclass:alternate 
 table-page-number:t1page table-page-count:t1pages 
 table-filtered-rowcount:t1filtercount 
 table-rowcount:t1allcount">
<thead> 
    <tr>
        <th style="width:auto" class="table-sortable:alphanumeric">
            MSSV
        </th>
        <th style="width:auto" class="table-sortable:alphanumeric">
            Name
        </th>
        <th style="width:auto" class="table-sortable:alphanumeric table-filterable">
            Department
        </th>
        <th style="width:auto"></th>
    </tr>
</thead>
<tbody> 
<% foreach (var item in Model)
   { %>
    <tr>
        <td>
            <%: Html.DisplayFor(modelItem => item.mssv) %>
        </td>
        <td>
            <%: Html.DisplayFor(modelItem => item.name) %>
        </td>
        <td>
            <%: Html.DisplayFor(modelItem => item.Tb_Department.name) %>
        </td>
        <td>
            <a href="/Student/Details/<%: item.id %>"><img title="Details" src="../../Content/images/details.png" /></a>
            <a href="/Student/Edit/<%: item.id %>"><img title="Edit" src="../../Content/images/edit.png" /></a>
            <a idstudent="<%: item.id %>" namestudent="<%: item.name %>"
            onclick="deleteinformation(this); jQuery('#dialogdelete').dialog('open'); return false" href="#"><img title="Delete" src="../../Content/images/delete.png" /></a>
        </td>
    </tr>
<% } %>
</tbody>
<tfoot>
	<tr>
		<td class="table-page:previous" style="cursor:pointer; text-align:right"><img src="../../Content/iconprevious.png" /></td>
		<td style="text-align:center" colspan="2" class="table-page-number:t1page">Page <span id="t1page"></span>&nbsp;of&nbsp;<span id="t1pages"></span></td>
        <td class="table-page:next" style="cursor:pointer; text-align:left"> <img src="../../Content/iconnext.png" /></td>
	</tr>
	<tr>
		<td colspan="5"><span id="t1filtercount"></span>&nbsp;of <span id="t1allcount"></span>&nbsp;rows match filter(s)</td>
    </tr>
</tfoot>
</table>
</dx:PanelContent>
</PanelCollection>
    </dx:ASPxRoundPanel>

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="HeadContent" runat="server">
<script type="text/javascript">
    $(function () {
        $("#dialogdelete").dialog({
            bgiframe: true,
            height: 200,
            width: 500,
            modal: true,
            autoOpen: false,
            resizable: false
        })
    });
        
    </script>
    <script type="text/javascript">
        function deleteinformation(e) {
            document.getElementById('id').value = e.getAttribute("idstudent");
            document.getElementById('name').value = e.getAttribute("namestudent");
            document.getElementById('name').innerHTML = e.getAttribute("namestudent");
        }
    </script>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="leftmenu" runat="server">
</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="menuright" runat="server">
</asp:Content>

<asp:Content ID="Content5" ContentPlaceHolderID="Footer" runat="server">
</asp:Content>
